//
//  LoginView.m
//  VoSAT
//
//  Created by 王译 on 2018/4/22.
//  Copyright © 2018年 王. All rights reserved.
//

#import "LoginView.h"

@implementation LoginView
- (instancetype)init
{
    self = [super init];
    if (self) {
        _topImageView = [[UIImageView alloc]init];
        _nameTextField = [[UITextField alloc]init];
        _pwdTextField = [[UITextField alloc]init];
//        _loginBtn = [[ZYButton alloc]initWithTitle:@"登录" font:MiddleFont color:WHITECOLOR selectColor:WHITECOLOR];
        _loginBtn = [[ZYButton alloc]init];
        [_loginBtn setTitle:@"登录" forState:UIControlStateNormal];
        _loginBtn.backgroundColor = [UIColor colorWithRed:30 green:156 blue:209 alpha:1];
        
        _queBtn = [[ZYButton alloc]initWithTitle:@"登录遇到问题？" font:MiddleFont];
        _dangerBtn = [[ZYButton alloc]initWithTitle:@"紧急呼叫" font:MiddleFont];
        [self sd_addSubviews:@[_topImageView,_nameTextField,_pwdTextField,_loginBtn,_queBtn,_dangerBtn]];
        [self initView];
    }
    return self;
}

-(void)initView{
    _topImageView.sd_layout
    .topEqualToView(self)
    .centerXEqualToView(self)
    .widthRatioToView(self, 1)
    .heightRatioToView(self, 0.3);
    _topImageView.backgroundColor = [UIColor blueColor];
    
    
    _nameTextField.sd_layout
    .topSpaceToView(_topImageView, 10)
    .centerXEqualToView(self)
    .widthRatioToView(self, 0.8)
    .heightIs(40);
    _nameTextField.placeholder = @"账号";
    
    _pwdTextField.sd_layout
    .topSpaceToView(_nameTextField, 5)
    .leftEqualToView(_nameTextField)
    .widthRatioToView(_nameTextField, 1)
    .heightRatioToView(_nameTextField, 1);
    _pwdTextField.placeholder = @"密码";
    
    _loginBtn.sd_layout
    .leftEqualToView(_pwdTextField)
    .topSpaceToView(_pwdTextField, 5)
    .widthRatioToView(_pwdTextField, 1)
    .heightRatioToView(_pwdTextField, 1);
    _loginBtn.backgroundColor = [UIColor blueColor];
    _queBtn.sd_layout
    .topSpaceToView(_loginBtn, 10)
    .widthRatioToView(self, 0.5)
    .centerXEqualToView(self)
    .heightIs(30);
    
    _dangerBtn.sd_layout
    .bottomSpaceToView(self, 20)
    .centerXEqualToView(self)
    .heightIs(30)
    .widthRatioToView(self, 0.5);
    
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
